import request from "@/utils/request";

type Result<T = undefined > = {
    code:string,
    message:string,
    data:T
}

// 登录
export function login(loginname:string,password:string) {
    return request.post<any,Result>('/user/login',{
        loginname,
        password
    })
}

// 验证手机号
export function docheckphone(tel:string) {
    return request.post<any,Result<string>>('/user/docheckphone',{tel})
}

// 获取验证码
export function dosendmsgcode(tel:string) {
    return request.post<any,Result<number>>('/user/dosendmsgcode',{
        tel
    })
}

// 验证手机号和验证码
export function docheckcode(tel:string,telcode:string) {
    return request.post<any,Result<string>>('/user/docheckcode',{
        tel,
        telcode
    })
}

// 注册
export function dofinishregister(tel:string,password:string) {
    return request.post<any,Result>('/user/dofinishregister',{
        tel,
        password
    })
}